package cn.webrx;

public class Ex3 {
    public static void main(String[] args) {
        int i = getNumA();
        System.out.println(i);


        i = getNumB();
        System.out.println(i);


        i = getNumC();
        System.out.println(i);
    }

    public static int getNumA() {
        System.out.println("getNumA()");
        int i = 1;
        try {
            int n = 3 / 0;
            ++i;
            System.out.println("i = " + i);
            return i;
        } catch (Exception e) {
            System.out.println("除数为0");
        } finally {
            ++i;
            System.out.println("i2 = " + i);
        }
        return i;
    }

    public static int getNumC() {
        System.out.println("getNumC()");
        int i = 1;
        try {
            int n = 3 / 0;
            ++i;
            System.out.println("i = " + i);
            return i;
        } catch (Exception e) {
            System.out.println("除数为0");
            return i;
        } finally {
            ++i;
            System.out.println("i2 = " + i);
            return i;
        }
    }

    public static int getNumB() {
        System.out.println("getNumB()");
        int i = 1;
        try {
            int n = 3 / 0;
            ++i;
            System.out.println("i = " + i);
            return i;
        } catch (Exception e) {
            System.out.println("除数为0");
            return i;
        } finally {
            ++i;
            System.out.println("i2 = " + i);
        }
    }
}
